JavaScript is a high-level, interpreted programming language that conforms to the ECMAScript specification. It is a language that is also characterized as dynamic, weakly typed, prototype-based and multi-paradigm.
JavaScript enables interactive web pages and is an essential part of web applications. The vast majority of websites use it for client-side page behavior, and all major web browsers have a dedicated JavaScript engine to execute it.
When a browser loads a web page with JavaScript, it:
JavaScript can be added to HTML documents in three ways:
Variables are containers for storing data values. JavaScript has three ways to declare variables:
JavaScript has dynamic types. The same variable can be used to hold different data types. JavaScript has 7 primitive data types and objects:
Type conversion is when we explicitly convert a value from one type to another. Type coercion is when JavaScript automatically converts types behind the scenes.
Operators are used to perform operations on variables and values. JavaScript has several types of operators:
Comments are used to explain JavaScript code, and to make it more readable. JavaScript comments can also be used to prevent execution when testing alternative code.
There are two types of comments in JavaScript: